<style>
    table tr {
        height: 32px;
    }

    table td {
        width: 15%;
    }

    .popover {
        word-break: break-all;
    }
</style>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <span style="padding-left: 2%;">
                        <span>请选择C环境机器:</span>
                        <select style="margin-left: 2%;" ng-change="changeC();" ng-model="info.selectC">
                            <option ng-repeat="c in info.c_ucloud_list" value="{{c}}">{{c}}</option>
                        </select>
                    </span>
                </div>
                <div class="box-body" style="margin-left: 2%;">
                    <span ng-if="info.errMsg != null"
                          style="color: red;">{{info.errMsg}}</span>
                    <span ng-if="info.errMsg == null">
                        <span ng-if="info.authorize.auth_qa">QA已授权</span>
                        <span ng-if="!info.authorize.auth_qa">QA未授权</span>;
                        <span ng-if="info.authorize.auth_ops">PD已授权</span>
                        <span ng-if="!info.authorize.auth_ops">PD未授权</span>;
                        <span ng-if="info.authorize.ogg_status">同步服务已设置执行</span>
                        <span ng-if="!info.authorize.ogg_status">同步服务已停止执行</span>
                        <br>
                        <br>
                        <span>同步服务状态:{{info.oggRunStatus}}</span>
                        <br>
                        <br>
                        <span>上次完成时间:{{info.authorize.completeDate}}</span>
                        <br>
                        <br>
                        <button class="btn btn-info" ng-click="authorize('auth_qa');"
                                ng-if="isUserCanOperateByRole('c_admin','qa') && !info.authorize.auth_qa">QA授权</button>
                        <button class="btn btn-info" ng-click="authorize('cancel_qa');"
                                ng-if="isUserCanOperateByRole('c_admin','qa') && info.authorize.auth_qa">取消QA授权</button>
                        <button class="btn btn-info" ng-click="authorize('auth_ops');"
                                ng-if="isUserCanOperateByRole('c_admin','c_pd') && info.authorize.auth_qa && !info.authorize.auth_ops">PD授权</button>
                        <button class="btn btn-info" ng-click="authorize('cancel_ops');"
                                ng-if="isUserCanOperateByRole('c_admin','c_pd') && info.authorize.auth_ops">取消PD授权</button>
                        <button class="btn btn-info" ng-click="authorize('cancel_all');"
                                ng-if="isUserCanOperateByRole('c_admin') && (info.authorize.auth_ops||info.authorize.auth_qa)">禁止授权</button>
                        <button class="btn btn-info" ng-click="checkData('all');"
                                ng-hide="!(isUserCanOperateByRole('c_admin','dba') && info.authorize.auth_ops&&info.authorize.auth_qa&&!info.authorize.ogg_status)">检查数据</button>
                        <button class="btn btn-info" ng-click="checkData('white');"
                                ng-disabled="!(isUserCanOperateByRole('c_admin','dba','c_pd') && info.authorize.auth_ops&&info.authorize.auth_qa&&!info.authorize.ogg_status)">检查白名单数据</button>
                        <button class="btn btn-info" ng-click="authorize('start_ogg');"
                                ng-hide="!(isUserCanOperateByRole('c_admin','dba') && info.authorize.auth_ops&&info.authorize.auth_qa&&!info.authorize.ogg_status)">启动同步服务</button>
                        <button class="btn btn-info" ng-click="authorize('start_white');"
                                ng-disabled="!(isUserCanOperateByRole('c_admin','dba','c_pd') && info.authorize.auth_ops&&info.authorize.auth_qa&&!info.authorize.ogg_status)">同步白名单</button>
                        <button class="btn btn-info" ng-click="changeTomStatus(false)"
                                ng-if="isUserCanOperateByRole('c_admin') &&info.authorize.tom_flag">允许修改tom配置</button>
                        <button class="btn btn-info" ng-click="changeTomStatus(true)"
                                ng-if="isUserCanOperateByRole('c_admin') &&!info.authorize.tom_flag">禁止修改tom配置</button>
                        <!--<button class="btn btn-info" ng-click="authorize('stop_ogg');"-->
                        <!--ng-if="isUserCanOperateByRole('c_admin','dba') && info.authorize.auth_ops&&info.authorize.auth_qa&&info.authorize.ogg_status">停止OGG</button>-->
                        <button class="btn btn-info" ng-click="cleanRedis();"
                                ng-if="isUserCanOperateByRole('c_admin','dba') && info.authorize.auth_ops&&info.authorize.auth_qa">清空线上redis</button>
                        <button class="btn btn-info" ng-click="cleanLocalRedis();">清空本机redis</button>
                        <button class="btn btn-info" ng-click="download('c');"
                                ng-hide="isUserHasRole('c_pd')">下载同步日志文件</button>
                        <button class="btn btn-info" ng-click="download('c_white_list');"
                                ng-hide="isUserHasRole('c_pd')">下载白名单日志</button>
                        <button class="btn btn-info" ng-click="budget();">预算配置同步</button>
                    </span>
                    <br>
                    <br>
                    <div ng-if="info.checkData != null">
                        <h4>服务检查</h4>
                        <div ng-bind-html="info.checkData"></div>
                    </div>
                    <div>
                        {{info.oggRunTotal}}
                    </div>
                    <!-- pms change log -->
                    <div>
                        <h4>PMS变更记录</h4>
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>表名</th>
                                <th>列名</th>
                                <th>旧值</th>
                                <th>新值</th>
                                <th>创建人</th>
                                <th>创建时间</th>
                                <th>修改人</th>
                                <th>修改时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr ng-repeat="i in info.pmsChangeLog">
                                <td>
                                    <a ng-if="i.table_NAME  != null" href="javascript:void(0)" class="btn-link"
                                       type="button"
                                       data-toggle="popover" data-placement="auto top"
                                       data-content="{{i.table_NAME}}" data-html="true"
                                       data-trigger="hover">
                                        {{i.table_NAME | limitTo: 20}}...</a>
                                </td>
                                <td>{{i.column_NAME}}</td>
                                <td>
                                    <a ng-if="i.old_VALUE  != null" href="javascript:void(0)" class="btn-link"
                                       type="button"
                                       data-toggle="popover" data-placement="auto top"
                                       data-content="{{i.old_VALUE}}" data-html="true"
                                       data-trigger="hover">
                                        {{i.old_VALUE | limitTo: 20}}...</a>
                                </td>
                                <td>
                                    <a ng-if="i.new_VALUE  != null" href="javascript:void(0)" class="btn-link"
                                       type="button"
                                       data-toggle="popover" data-placement="auto top"
                                       data-content="{{i.new_VALUE}}" data-html="true"
                                       data-trigger="hover">
                                        {{i.new_VALUE | limitTo: 20}}...</a>
                                </td>
                                <td>{{i.createdby}}</td>
                                <td>{{i.created|date:'yyyy-MM-dd HH:mm:ss'}}</td>
                                <td>{{i.updatedby}}</td>
                                <td>{{i.updated|date:'yyyy-MM-dd HH:mm:ss'}}</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
